package org.nepu.scr.indexrate.converter.longevityrate;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.longevityrate.DefaultC32;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class DefaultC32Converter implements AttributeConverter<DefaultC32, String> {
    @Override
    public String convertToDatabaseColumn(DefaultC32 defaultC32) {
        return JSONUtil.toJsonStr(defaultC32);
    }

    @Override
    public DefaultC32 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, DefaultC32.class);
    }
}
